package com.xz.demo.model;

/**
 * @author 张志航     
 * @version V1.0.0
 * @projectName design_mode
 * @title     ConcretePrototype   
 * @package    com.xz.demo.model  
 * @date   2019/11/29 16:38  
 * @explain
 */
// 在原型类的clone方法中实例化一个与自身相同的对象,保证他们的成员变量相同
public class ConcretePrototype {

    private String attr;

    public String getAttr() {
        return attr;
    }

    public void setAttr(String attr) {
        this.attr = attr;
    }

    public ConcretePrototype clone() {
        ConcretePrototype prototype = new ConcretePrototype();
        prototype.setAttr(this.attr);
        return prototype;
    }
}
